#include <iostream>
using namespace std;
#include<vector>
#include <algorithm>
int main() {
    int n;
    cin >> n;
    vector<long long int> ave;
    int begin = 0;
    ave.resize(3 * n);
    for (int i = 1; i <= 3 * n; i++)
    {
        int cst;
        cin >> cst;
        ave.push_back(cst);
    }
    sort(ave.begin(), ave.end()); int k;
    for (k = 0; k < ave.size(); k++)
    {
        if (ave[k] == 0)  begin++;
    }
    int sum = 0;
    for (int j = n + begin; j < n + n + begin; j++)
    {
        sum += ave[j];
    }
    cout << sum;
}